<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>魏远商城</title>
    <link rel="stylesheet" type="text/css" href="../../css/common/public.css" />
    <link rel="stylesheet" type="text/css" href="../../css/home/enterprice.css" />
    <link rel="stylesheet" type="text/css" href="../../assets/swiper-3.4.2.min.css"/>
    <!--<link rel="stylesheet" type="text/css" href="../../css/common/public.css" />-->   
    <script src="../../assets/swiper-3.4.2.min.js"></script>
    <script src="../../assets/jquery-3.1.1.min.js"></script>
    <!--<script src="../../js/public.js"></script>-->
</head>
<body>
	<div class="top_all">
		<div class="top">
			<div class="top_con">
				<div class="tlogin"></div>
				<div class="gotoregister" style="display: none;">免费注册</div>
				<div class="homepage">商城首页</div>
				<div class="tmyorder">我的订单<img src="../../image/turn_down.png"></div>						
				<div class="home_car"><img src="../../image/shop_car.png">购物车<span class="car_time">0</span></div>
				<div class="line_ke">联系客服<img src="../../image/turn_down.png"></div>							
			</div>		
		</div>
		<div class="loged" style="display: none;">
			<div><span class="guanli">账号管理</span>|<span class="out">退出</span></div>
			<div class="thead">
				<div class="thead_pic"><span></span></div>
				<div class="tmenber">企业会员</div>
			</div>
		</div>
		<div class="myorder">
			<span class="order_1">待支付</span>
			<span class="order_2">待发货</span>
			<span class="order_3">待收货</span>
			<span class="order_4">待评价</span>
		</div>
		<div class="tcont">
			<span class="mine1">用户帮助</span>
			<span class="mine2">联系客服</span>
			<span class="mine3">投诉建议</span>
			<span class="mine4">退换货</span>
			<span class="mine5">收货地址管理</span>
		</div>
		
		<div class="logeandsear">
			<div class="imageLogo"><img src="../../image/Logo.png"></div>
			<div class="search">
				<div>
					<img class="search-icon" src="../../image/search-icon.png"><input type="text" class="home_searchto" placeholder="魏远产品搜索" /><span class="gotosearch">搜索</span>
				</div>
			</div>
	    </div>
	</div>	
	<div class="right">
			<div class="right_car"><span><img src="../../image/righr_car.png"></br>购</br>物</br>车</span></div>
		<div class="youhuiquan"><span>优</br>惠</br>券</span></div>
		<div class="qianbao"><span>钱</br>包</span></div>
		<div class="qiyeshangc"><span>企</br>业</br>商</br>城</span></div>
		<div class="totop"><span><br/>^<br/>TOP</span></div>
	</div>
	
	<div class="wrap">
		<div class="select">
			<div>
				<span class="alltype">全部商品分类</span>
				<span  class="home_hot">热销爆款</span>
				<span class="home_new">新品速递</span>
				<span class="home_acv">营销活动</span>
				<span class="home_topg">优品馆</span>
				<!--李勇-->
					<div class="downtypeg" style="display: none;">
						<div class="downtypegdivall">
							<div class="downtypegdiv"></div>						
							<div class="downcatediv" style="display: none;"></div>						
						</div>
				    </div>
					<!--李勇结束-->
				<!--<div class="downtypeg"  style="display: none;">
					
				</div>-->
			</div>
		</div>
		<div class="package">
			<p><span class="ttitle"></span></p>
			<div class="package_con">
				<span>套餐</span>
				<div class="package_content">
					<div class="package_1 packagediv"  style="display: none;">
						<div class="package_1pic1"></div>
						<p>￥<span class="package_1p1"></span></p>
						<p class="package_1n1"></p>
					</div>
					<div class="package_2 package_2m packagediv"  style="display: none;">
						<div class="package_1pic2"></div>
						<p>￥<span class="package_1p2"></span></p>
						<p class="package_1n2"></p>
					</div>
					<div class="package_2 package_3m packagediv" style="display: none;">
						<div class="package_1pic3"></div>
						<p>￥<span class="package_1p3"></span></p>
						<p class="package_1n3"></p>
					</div>
					<div class="package_content3">
					 
						<!--<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>
						<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>
						<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>
						<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>
						<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>
						<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>
						<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>
						<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>
						<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>-->
					</div>
					<!--<div class="clean"></div>-->
				</div>
			</div>
			
			<div class="sigle_con">
				<span>单品</span>
				<div class="sigle_content3">
					 
						<!--<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>
						<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>
						<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>
						<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>
						<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>
						<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>
						<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>
						<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>
						<div class="package_3">
							<div></div>
							<p>￥<span>100</span></p>
							<p>阿斯顿发斯蒂芬</p>
						</div>-->
					</div>
			</div>
		</div>		
	</div>
    <div class="wrap">
		<div class="wrap_bottom"><img src="../../image/bottom.png"></div>
	</div>
<script type="text/javascript" src="../../js/url.js"></script>
<script>
	 
	 $('.downtypeg').css('height','500px');

			$('.packagediv').on('click', function() {
				
                   		whereto($(this).attr('skuqid'));
			});
	
	        $('.package_content3').on('click','.package_3' ,function() {
				
                   		whereto($(this).attr('skuqid'));
			});
	
	        $('.sigle_content3').on('click','.package_3', function() {
				
                   		whereto($(this).attr('skuqid'));
			});
	
	        function whereto(skuqid){
	        	localStorage.wyshopwheredetails = skuqid;
	        	window.location.href='../goods/detalis.html';
	        }
	
	            getgoodslist();
	            function getgoodslist() {
				$.ajax({
					url: ur + '/mobile/product/getProductListByEnterpriseId',
					type: 'POST',
					headers: {
						"X-Token":localStorage.wyshoptoken
					},
					dataType: 'json',
					data: {
						"enterpriseId": localStorage.wyshoppriseId,

					},
					success: function(data) {
						
//						$('.img1').text(data.result.data.enterpriseName);
						//							console.log(data.result.data.combinationPVo.length);
						if(data.result.meta.code == 200) {
						  
							$('.ttitle').text(data.result.data.enterpriseName);
							if(data.result.data.combinationPVo.length==0){
								$('.package_con').css('display','none');
							}
								if(data.result.data.combinationPVo.length==1){
									var mt1 = data.result.data.combinationPVo[0].mainImg;									
										
										var m = mt1.indexOf(',');
										var mainImg;
										if(m != '-1') {
											mainImg = mt1.substring(0, m);
										} else {
											mainImg = mt1;
										}
									$('.package_1pic1').css('background-image','url(' + picur + mainImg + ')');
									var p1 = data.result.data.combinationPVo[0].newPrice;
									var rp1 =  Math.round(p1 * 100) / 100;
									$('.package_1p1').text(rp1);
									$('.package_1n1').text(data.result.data.combinationPVo[0].shortname);
									
									
									$('.package_1').css('display','block');
									$('.package_1').attr('skuqid',data.result.data.combinationPVo[0].id);
								}else if(data.result.data.combinationPVo.length==2){
//									alert()
									var mt1 = data.result.data.combinationPVo[0].mainImg;
									var m = mt1.indexOf(',');
										var mainImg;
										if(m != '-1') {
											mainImg = mt1.substring(0, m);
										} else {
											mainImg = mt1;
										}
									$('.package_1pic1').css('background-image','url(' + picur + mainImg + ')');
									var p1 = data.result.data.combinationPVo[0].newPrice;
									var rp1 =  Math.round(p1 * 100) / 100;
									$('.package_1p1').text(rp1);
									$('.package_1n1').text(data.result.data.combinationPVo[0].shortname);
									
									
									var mt2 = data.result.data.combinationPVo[1].mainImg;
									var m = mt2.indexOf(',');
										var mainImg2;
										if(m != '-1') {
											mainImg2 = mt2.substring(0, m);
										} else {
											mainImg2 = mt2;
										}
									$('.package_1pic2').css('background-image','url(' + picur + mainImg2 + ')');
									var p2 = data.result.data.combinationPVo[1].newPrice;
									var rp2 =  Math.round(p2 * 100) / 100;
									$('.package_1p2').text(rp2);
									$('.package_1n2').text(data.result.data.combinationPVo[1].shortname);
									
									$('.package_2m').css('display','block');
									$('.package_1').css('display','block');
									$('.package_1').attr('skuqid',data.result.data.combinationPVo[0].id);
									$('.package_2').attr('skuqid',data.result.data.combinationPVo[1].id);
								}else if(data.result.data.combinationPVo.length==3){
									
									var mt1 = data.result.data.combinationPVo[0].mainImg;
									var m = mt1.indexOf(',');
										var mainImg;
										if(m != '-1') {
											mainImg = mt1.substring(0, m);
										} else {
											mainImg = mt1;
										}
									$('.package_1pic1').css('background-image','url(' + picur + mainImg + ')');
									var p1 = data.result.data.combinationPVo[0].newPrice;
									var rp1 =  Math.round(p1 * 100) / 100;
									$('.package_1p1').text(rp1);
									$('.package_1n1').text(data.result.data.combinationPVo[0].shortname);
									
									
									var mt2 = data.result.data.combinationPVo[1].mainImg;
									var m = mt2.indexOf(',');
										var mainImg2;
										if(m != '-1') {
											mainImg2 = mt2.substring(0, m);
										} else {
											mainImg2 = mt2;
										}
									$('.package_1pic2').css('background-image','url(' + picur + mainImg2 + ')');
									var p2 = data.result.data.combinationPVo[1].newPrice;
									var rp2 =  Math.round(p2 * 100) / 100;
									$('.package_1p2').text(rp2);
									$('.package_1n2').text(data.result.data.combinationPVo[1].shortname);
									
									
									var mt3 = data.result.data.combinationPVo[2].mainImg;
									var m = mt2.indexOf(',');
										var mainImg3;
										if(m != '-1') {
											mainImg3 = mt2.substring(0, m);
										} else {
											mainImg3 = mt2;
										}
									$('.package_1pic3').css('background-image','url(' + picur + mainImg3 + ')');
									var p3 = data.result.data.combinationPVo[2].newPrice;
									var rp3 =  Math.round(p3 * 100) / 100;
									$('.package_1p3').text(rp3);
									$('.package_1n3').text(data.result.data.combinationPVo[2].shortname);
									
									$('.package_2m').css('display','block');
									$('.package_3m').css('display','block');
									$('.package_1').css('display','block');
									$('.package_1').attr('skuqid',data.result.data.combinationPVo[0].id);
									$('.package_2').attr('skuqid',data.result.data.combinationPVo[1].id);
									$('.package_3').attr('skuqid',data.result.data.combinationPVo[2].id);
								}else if(data.result.data.combinationPVo.length>3){

                                 
                                 
                                 var mt1 = data.result.data.combinationPVo[0].mainImg;
									var m = mt1.indexOf(',');
										var mainImg;
										if(m != '-1') {
											mainImg = mt1.substring(0, m);
										} else {
											mainImg = mt1;
										}
									$('.package_1pic1').css('background-image','url(' + picur + mainImg + ')');
									var p1 = data.result.data.combinationPVo[0].newPrice;
									var rp1 =  Math.round(p1 * 100) / 100;
									$('.package_1p1').text(rp1);
									$('.package_1n1').text(data.result.data.combinationPVo[0].shortname);
									
									
									var mt2 = data.result.data.combinationPVo[1].mainImg;
									var m = mt2.indexOf(',');
										var mainImg2;
										if(m != '-1') {
											mainImg2 = mt2.substring(0, m);
										} else {
											mainImg2 = mt2;
										}
									$('.package_1pic2').css('background-image','url(' + picur + mainImg2 + ')');
									var p2 = data.result.data.combinationPVo[1].newPrice;
									var rp2 =  Math.round(p2 * 100) / 100;
									$('.package_1p2').text(rp2);
									$('.package_1n2').text(data.result.data.combinationPVo[1].shortname);
									
									
									var mt3 = data.result.data.combinationPVo[2].mainImg;
									var m = mt2.indexOf(',');
										var mainImg3;
										if(m != '-1') {
											mainImg3 = mt2.substring(0, m);
										} else {
											mainImg3 = mt2;
										}
									$('.package_1pic3').css('background-image','url(' + picur + mainImg3 + ')');
									var p3 = data.result.data.combinationPVo[2].newPrice;
									var rp3 =  Math.round(p3 * 100) / 100;
									$('.package_1p3').text(rp3);
									$('.package_1n3').text(data.result.data.combinationPVo[2].shortname);
									
									$('.package_2m').css('display','block');
									$('.package_3m').css('display','block');
									$('.package_1').css('display','block');
									$('.package_1').attr('skuqid',data.result.data.combinationPVo[0].id);
									$('.package_2').attr('skuqid',data.result.data.combinationPVo[1].id);
									$('.package_3').attr('skuqid',data.result.data.combinationPVo[2].id);
                                 
                                 



								for(var i = 3; i < data.result.data.combinationPVo.length; i++) {
								
								var b = data.result.data.combinationPVo[i].mainImg;
								//													console.log(b.indexOf(',') + '逗号索引值');
								var m = b.indexOf(',');
								if(m != '-1') {
									var mainImg = b.substring(0, m);
								} else {
									mainImg = b;
								}
								
								var newprice = data.result.data.combinationPVo[i].newPrice;
                                 var fprice = Math.round(newprice * 100) / 100;
								console.log(data.result.data.combinationPVo[i].mainImg);
//								var div = ('<div class="content" id="' + data.result.data.combinationPVo[i].id + '" skuqid="' + data.result.data.combinationPVo[i].skuId + ' ">' +
//									'<div style="background-image:url(' + picur + mainImg + ');background-size:cover ;background-position: center;background-repeat: no-repeat;"></div>' +
//									'<div class="main" style="border: 0px;">' +
//									'<p>' + data.result.data.combinationPVo[i].shortname + '</p>' +
//									'<p>' + data.result.data.combinationPVo[i].description + '</p>' +
//									'<p><span>' + fprice + '</span>元<img src="img/corporate2.png"></p></div>' +
//									'</div>');
                                
                                var div = ('<div class="package_3 " skuqid="' + data.result.data.combinationPVo[i].id + ' ">'+
												'<div style="background-image:url(' + picur + mainImg + ');background-size:cover ;background-position: center;background-repeat: no-repeat;"></div>'+
												'<p>￥<span>' + fprice + '</span></p>'+
												'<p>' + data.result.data.combinationPVo[i].shortname + '</p>'+
											'</div>');
								$('.package_content3').append(div);
							}}
							if(data.result.data.productVOs.length==0){
								$('.sigle_con').css('display','none');
							}else{
								for(var u = 0; u < data.result.data.productVOs.length; u++) {
									var b = data.result.data.productVOs[u].mainImg;
									//													console.log(b.indexOf(',') + '逗号索引值');
									var m = b.indexOf(',');
									if(m != '-1') {
										var mainImg = b.substring(0, m);
									} else {
										mainImg = b;
									}
	                                 var newprice2 = data.result.data.productVOs[u].newPrice;
	                                 var fprice2 = Math.round(newprice2 * 100) / 100;
	//								var divdan = ('<div class="home-danq" id="' + data.result.data.productVOs[u].id + '" skuqid="' + data.result.data.productVOs[u].skuId + '"><p style="background-image: url(' + picur + mainImg + ');background-size: cover;background-position:center;"></p><p><span>' + data.result.data.productVOs[u].shortname + '</span>' +
	//									'<span>' + data.result.data.productVOs[u].description + '</span>' +
	//									'<span><span style="font-size: 14px;">￥</span>' + fprice2 + '</span></p></div>');
										
									var divdan = ('<div class="package_3" skuqid="' + data.result.data.productVOs[u].id + ' ">'+
														'<div style="background-image:url(' + picur + mainImg + ');background-size:cover ;background-position: center;background-repeat: no-repeat;"></div>'+
														'<p>￥<span>' + fprice2 + '</span></p>'+
														'<p>' + data.result.data.productVOs[u].shortname + '</p>'+
													'</div>');	
										
										
									$('.sigle_content3').append(divdan);
	
								}
							}	
						}else if (data.result.meta.code = 201){
//							alert('没有该企业');
                             $('.package').html('');
                             $('.package').css('height','300px');
                           var divimg = $('<div style="margin:5rem auto 0;text-align: center;"><p style="color:#999999;font-size: 18px;">暂时没有企业商品</p></div>');
	                         	$('.package').append(divimg);
						}
					},
					error:function(){
						
					}
				})

			}
	            
	            
	
	

</script>
</body>
</html>